//
//  TestUIViewViewController.m
//  iOSDeme
//
//  Created by wxf on 2024/8/25.
//

#import "TestUIViewViewController.h"

@interface TestUIViewViewController ()

@end

@implementation TestUIViewViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSLog(@"TestUILabelViewController viewDidLoad");
    self.view.backgroundColor = [UIColor whiteColor];
    [self mainTest];
}

- (void)mainTest{
    //CGRectMake -- 提供范围
    UIView *view0 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    //设置View背景颜色
    view0.backgroundColor = [UIColor redColor];
    //添加到window中
    [self.view addSubview:view0];
    
    
    
    //自定义View
    //CGRectMake -- 提供范围
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    //设置View背景颜色
    view.backgroundColor = [UIColor yellowColor];
    //添加到window中
    [self.view addSubview:view];
    
    UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(100, 300, 100, 100)];
    view1.backgroundColor = [UIColor greenColor];
    [self.view addSubview:view1];
    
    //frame  -该视图在父视图中的位置和大小(参照点：父视图的坐标系统)
    //bounds -该视图在本地坐标系中的位置和大小(参照点：自己视图的坐标系统)
    //center -该view的中心点在父view坐标系统中的位置和大小 (参照点：父视图的坐标系统)
    //CGRect - 结构体  CGPoint 点 + CGSize 大小
    
    
    UIView *view2= [[UIView alloc] initWithFrame:CGRectMake(100, 200, 100, 100)];
    //view2.backgroundColor = [UIColor yellowColor];
    //设置背景颜色 - 根据ARGB
    // a   - 0.1.0
    // rgb - 0 -255
    view2.backgroundColor = [UIColor colorWithRed:150/255.0 green:20/255.0 blue:50/255.0 alpha:0.5];
    //添加到window中
    [self.view addSubview:view2];
}

@end
